package com.huage_09.lesson_01;

public class EatableDemo {
    public static void main(String[] args) {
        //通过编写实现类
        Eatable e = new EatableImpl();
        UseEatable(e);
        System.out.println("--------");

        //通过匿名内部类
        UseEatable(new Eatable() {
            @Override
            public void eat() {
                System.out.println("吃香蕉");
            }
        });
        System.out.println("--------");

        //通过Lambda表达式
        UseEatable(()->{
            System.out.println("吃梨子");
        });
    }
    public static void UseEatable(Eatable e){
        e.eat();
    }
}
